#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<string>
using namespace std;
char a[110];
int main()
{
    string s, res;
    cin.getline(a, 110);
    s = a;
    string::iterator begin = s.begin() + (s.size() - 1);
    string::iterator end = s.end();
    while (begin != s.begin())
    {
        while (begin != s.begin() && *begin != ' ')begin--;
        if (begin == s.begin()) res += {begin, end};
        else
            res += {begin + 1, end};
        if (begin != s.begin())
            res += " ";
        end = begin;
        if(begin != s.begin())
        begin--;
    }
    if (*(begin + 1) == ' ') res += *begin;
    cout << res;
}